package rpg;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class TimerTask extends java.util.TimerTask 
{
	Mapcanvas mapCanvas;
	int type;
	int s;
	int n;
	int j;
	Graphics g;
	public TimerTask(Mapcanvas g,int i)
	{
		this.mapCanvas=g;
		this.type=i;
		this.s=2;
		this.n=0;
	}
	public TimerTask(Mapcanvas g,int i,Graphics g1){
		this.mapCanvas=g;
		this.type=i;
		this.s=2;
		this.n=0;
		this.g=g1;
	}
	public void run()
	{
		if(mapCanvas.running)
		{			
			switch(type)
			{
		        case -2://weather system
		        	mapCanvas.isWeather=true;
			        if(n%1000==0)
			        {
			        	s=mapCanvas.getRandom(3);
			        	mapCanvas.snow=new int[30][30];
			        	for(int i=0;i<mapCanvas.snow.length;i++)
			        	for(int j=0;j<mapCanvas.snow[0].length;j++)
			        		mapCanvas.snow[i][j]=30000;
			        }
			        if(n==60000)
			        n=0;
			        n++;
			        mapCanvas.repaint();
			        break;
		        case 2://normal attacks
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+(mapCanvas.attackNum==0?mapCanvas.totalPower:mapCanvas.totalPower1);
		        		if(attack<0)attack=0;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack, 150, 100, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack, 168, 143, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack, 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack1=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+(mapCanvas.attackNum==0?mapCanvas.totalPower:mapCanvas.totalPower1);
		        		if(attack1<0)attack1=0;
		        		mapCanvas.enemies[mapCanvas.attackedNum-2].HP-=attack1;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack1, 150, 100, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack1, 168, 143, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack1, 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
	        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX,mapCanvas.fightBoyY,0);
	        			if(mapCanvas.isTask[2]){
	        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX,mapCanvas.fightGirlY,0);
	        			
	        			}
	        			for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
	        			mapCanvas.flushGraphics();
	        			if(mapCanvas.enemies[mapCanvas.attackedNum-2].HP<=0){
	        				mapCanvas.getExp+=mapCanvas.enemies[mapCanvas.attackedNum-2].experience;
	        				mapCanvas.getMoney+=mapCanvas.enemies[mapCanvas.attackedNum-2].momey;
	        				mapCanvas.enemies[mapCanvas.attackedNum-2]=null;
	        			}
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkWin();
		        		mapCanvas.cancelAttackTask();
		        	}
		        	++s;
		        	break;
		        case 3://enemy attacks
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(mapCanvas.attackNum==i+2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x-10, mapCanvas.enemies[i].y, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackedNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX-10,mapCanvas.fightBoyY,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackedNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX-10,mapCanvas.fightGirlY,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(mapCanvas.attackNum==i+2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x-10, mapCanvas.enemies[i].y, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack=mapCanvas.enemies[mapCanvas.attackNum-2].basicPower-mapCanvas.totalDefence;
		        		if(attack<0)attack=0;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==0)
		        			g.drawString("-"+attack,35,143,0);
		        		else
		        			g.drawString("-"+attack,50,200,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackedNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX-10,mapCanvas.fightBoyY,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackedNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX-10,mapCanvas.fightGirlY,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(mapCanvas.attackNum==i+2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x-10, mapCanvas.enemies[i].y, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack1=mapCanvas.enemies[mapCanvas.attackNum-2].basicPower-mapCanvas.totalDefence;
		        		mapCanvas.HP-=attack1;
		        		if(attack1<0)attack=0;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==0)
		        			g.drawString("-"+attack1,35,133,0);
		        		else
		        			g.drawString("-"+attack1,50,190,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkDead();
	        			mapCanvas.cancelAttackTask();	        		
		        	}
		        	++s;
		        	break;
		        	
		        case 4://moving skill model
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		mapCanvas.curSkillX=70;
		        		mapCanvas.curSkillY=45*mapCanvas.attackedNum;
		        		if(mapCanvas.attackedNum==4)
		        		{
		        			mapCanvas.curSkillX=80;
		        			mapCanvas.curSkillY=155;
		        		}
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
						g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		mapCanvas.curSkillX+=40;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
						g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 5:
		        		mapCanvas.curSkillX+=40;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
						g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 6:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
						mapCanvas.flushGraphics();
		        		break;
		        	case 7:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        		if(attack<0)attack=0;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack, 150, 100, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack, 168, 143, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack, 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 8:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack1=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        		if(attack1<0)attack1=0;
		        		mapCanvas.enemies[mapCanvas.attackedNum-2].HP-=attack1;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack1, 150, 90, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack1, 168, 133, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack1, 195, 195, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.fightBoyX=35;
	        			mapCanvas.fightBoyY=150;
	        			g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
	        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX,mapCanvas.fightBoyY,0);
	        			if(mapCanvas.isTask[2]){
	        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX,mapCanvas.fightGirlY,0);
	        			
	        			}
	        			for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
	        			mapCanvas.flushGraphics();
	        			if(mapCanvas.enemies[mapCanvas.attackedNum-2].HP<=0){
	        				mapCanvas.getExp+=mapCanvas.enemies[mapCanvas.attackedNum-2].experience;
	        				mapCanvas.getMoney+=mapCanvas.enemies[mapCanvas.attackedNum-2].momey;
	        				mapCanvas.getThings[mapCanvas.attackedNum-2]=(byte)(mapCanvas.enemies[mapCanvas.attackedNum-2].LVL+30);//the level of the enemy must be less than 29
	        				mapCanvas.enemies[mapCanvas.attackedNum-2]=null;
	        			}
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkWin();
		        		mapCanvas.cancelAttackTask();
		        	}
		        	++s;
		        	break;
		        case 5://moving skill model(all)
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.curSkillX=60;
		        		mapCanvas.curSkillY=70;
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+60,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+120,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		mapCanvas.curSkillX+=40;
		        		g.drawImage(mapCanvas.imgFightBg,0,0,0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+60,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+120,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 5:
		        		mapCanvas.curSkillX+=40;
		        		g.drawImage(mapCanvas.imgFightBg,0,0,0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+60,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+120,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 6:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		int []attack=new int[3];
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				attack[i]=-mapCanvas.enemies[i].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        				if(attack[i]<0)attack[i]=0;
		        				mapCanvas.enemies[i].HP-=attack[i];
		        			}
		        		}
		        		g.setColor(255,0,0);
		        		if(attack[0]!=0)
		        			g.drawString("-"+attack[0], 150, 100, 0);
		        		if(attack[1]!=0)
			        		g.drawString("-"+attack[1], 168, 143, 0);
		        		if(attack[2]!=0)
		        			g.drawString("-"+attack[2], 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 7:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		int []attack1=new int[3];
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				attack1[i]=-mapCanvas.enemies[i].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        				if(attack1[i]<0)attack1[i]=0;
		        				mapCanvas.enemies[i].HP-=attack1[i];
		        			}
		        		}
		        		g.setColor(255,0,0);
		        		if(attack1[0]!=0)
		        			g.drawString("-"+attack1[0], 150, 90, 0);
		        		if(attack1[1]!=0)
			        		g.drawString("-"+attack1[1], 168, 133, 0);
		        		if(attack1[2]!=0)
		        			g.drawString("-"+attack1[2], 195, 195, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	default:
	        			g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
	        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX,mapCanvas.fightBoyY,0);
	        			if(mapCanvas.isTask[2]){
	        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX,mapCanvas.fightGirlY,0);
	        			
	        			}
	        			for(int i=0;i<3;++i){
	        				if(mapCanvas.enemies[i]!=null){
		        				if(mapCanvas.enemies[i].HP<=0){
			        				mapCanvas.getExp+=mapCanvas.enemies[i].experience;
			        				mapCanvas.getMoney+=mapCanvas.enemies[i].momey;
			        				mapCanvas.getThings[i]=(byte)(mapCanvas.enemies[i].LVL+30);
			        				mapCanvas.enemies[i]=null;
			        			}
	        				}
		        		}
	        			for(int i=0;i<3;++i){
	        				if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
	        			}
	        			
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkWin();
		        		mapCanvas.cancelAttackTask();
		        	}
		        	++s;
		        	break;
		        case 6://middle appearance skill model
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		mapCanvas.curSkillX=100;
		        		mapCanvas.curSkillY=130;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY-70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY+70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY+70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY-70,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY-80,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+80,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 5:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY-70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY+70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY+70,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY-70,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 6:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX, mapCanvas.curSkillY, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY-80,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY+80,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX-50,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+50,mapCanvas.curSkillY,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 7:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        		if(attack<0)attack=0;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack, 150, 100, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack, 168, 143, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack, 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 8:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				if(i==mapCanvas.attackedNum-2)
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				else
		        					g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        			}
		        		}
		        		int attack1=-mapCanvas.enemies[mapCanvas.attackedNum-2].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        		if(attack1<0)attack1=0;
		        		mapCanvas.enemies[mapCanvas.attackedNum-2].HP-=attack1;
		        		g.setColor(255,0,0);
		        		if(mapCanvas.attackedNum==2)
		        			g.drawString("-"+attack1, 150, 90, 0);
		        		else if(mapCanvas.attackedNum==3)
			        		g.drawString("-"+attack1, 168, 133, 0);
		        		else if(mapCanvas.attackedNum==4)
		        			g.drawString("-"+attack1, 195, 195, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	default:
	        			g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
	        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX,mapCanvas.fightBoyY,0);
	        			if(mapCanvas.isTask[2]){
	        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX,mapCanvas.fightGirlY,0);
	        			}
	        			for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
	        			mapCanvas.flushGraphics();
	        			if(mapCanvas.enemies[mapCanvas.attackedNum-2].HP<=0){
	        				mapCanvas.getExp+=mapCanvas.enemies[mapCanvas.attackedNum-2].experience;
	        				mapCanvas.getMoney+=mapCanvas.enemies[mapCanvas.attackedNum-2].momey;
	        				mapCanvas.getThings[mapCanvas.attackedNum-2]=(byte)(mapCanvas.enemies[mapCanvas.attackedNum-2].LVL+30);
	        				mapCanvas.enemies[mapCanvas.attackedNum-2]=null;
	        			}
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkWin();
		        		mapCanvas.cancelAttackTask();
		        	}
		        	++s;
		        	break;
		        case 7://fall skill model
		        	switch(s){
		        	case 2:
		        		mapCanvas.fightBoyX=35;
		        		mapCanvas.fightBoyY=150;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		mapCanvas.curSkillX=185;
		        		mapCanvas.curSkillY=100;
		        		g.drawImage(mapCanvas.imgFightBg,0,0,0);
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX-30, mapCanvas.curSkillY-60, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+20,mapCanvas.curSkillY+60,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		mapCanvas.curSkillY+=45;
		        		g.drawImage(mapCanvas.imgFightBg,0,0,0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX-30, mapCanvas.curSkillY-60, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+20,mapCanvas.curSkillY+60,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 5:
		        		mapCanvas.curSkillY=100;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX-30, mapCanvas.curSkillY-60, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+20,mapCanvas.curSkillY+60,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 6:
		        		mapCanvas.curSkillY+=45;
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			mapCanvas.fightGirlX=50;
		        			mapCanvas.fightGirlY=200;
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
		        		}
		        		g.drawImage(mapCanvas.imgCurAttack, mapCanvas.curSkillX-30, mapCanvas.curSkillY-60, 0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX,mapCanvas.curSkillY,0);
		        		g.drawImage(mapCanvas.imgCurAttack,mapCanvas.curSkillX+20,mapCanvas.curSkillY+60,0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 7:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		int []attack=new int[3];
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				attack[i]=-mapCanvas.enemies[i].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        				if(attack[i]<0)attack[i]=0;
		        				mapCanvas.enemies[i].HP-=attack[i];
		        			}
		        		}
		        		g.setColor(255,0,0);
		        		if(attack[0]!=0)
		        			g.drawString("-"+attack[0], 150, 100, 0);
		        		if(attack[1]!=0)
			        		g.drawString("-"+attack[1], 168, 143, 0);
		        		if(attack[2]!=0)
		        			g.drawString("-"+attack[2], 195, 205, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	case 8:
		        		g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
		        		if(mapCanvas.attackNum==0)
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX+25,mapCanvas.fightBoyY-10,0);
		        		else
		        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX, mapCanvas.fightBoyY, 0);
		        		if(mapCanvas.isTask[2]){
		        			if(mapCanvas.attackNum==1){
		        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX+25,mapCanvas.fightGirlY-10,0);
		        			}
		        			else
		        				g.drawImage(mapCanvas.imgFightGirl, mapCanvas.fightGirlX, mapCanvas.fightGirlY, 0);
		        		}
		        		int []attack1=new int[3];
		        		for(int i=0;i<3;++i){
		        			if(mapCanvas.enemies[i]!=null){
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x+10, mapCanvas.enemies[i].y+5, 0);
		        				attack1[i]=-mapCanvas.enemies[i].basicDefence+mapCanvas.getSkillHurt(mapCanvas.attackNum==0?true:false);
		        				if(attack1[i]<0)attack1[i]=0;
		        				mapCanvas.enemies[i].HP-=attack1[i];
		        			}
		        		}
		        		g.setColor(255,0,0);
		        		if(attack1[0]!=0)
		        			g.drawString("-"+attack1[0], 150, 90, 0);
		        		if(attack1[1]!=0)
			        		g.drawString("-"+attack1[1], 168, 133, 0);
		        		if(attack1[2]!=0)
		        			g.drawString("-"+attack1[2], 195, 195, 0);
						mapCanvas.flushGraphics();
		        		break;
		        	default:
	        			g.drawImage(mapCanvas.imgFightBg, 0, 0, 0);
	        			g.drawImage(mapCanvas.imgFightBoy,mapCanvas.fightBoyX,mapCanvas.fightBoyY,0);
	        			if(mapCanvas.isTask[2]){
	        				g.drawImage(mapCanvas.imgFightGirl,mapCanvas.fightGirlX,mapCanvas.fightGirlY,0);
	        			
	        			}
	        			for(int i=0;i<3;++i){
	        				if(mapCanvas.enemies[i]!=null){
		        				if(mapCanvas.enemies[i].HP<=0){
			        				mapCanvas.getExp+=mapCanvas.enemies[i].experience;
			        				mapCanvas.getMoney+=mapCanvas.enemies[i].momey;
			        				mapCanvas.getThings[i]=(byte)(mapCanvas.enemies[i].LVL+30);
			        				mapCanvas.enemies[i]=null;
			        			}
	        				}
		        		}
	        			for(int i=0;i<3;++i){
	        				if(mapCanvas.enemies[i]!=null)
		        				g.drawImage(mapCanvas.enemies[i].enemy, mapCanvas.enemies[i].x, mapCanvas.enemies[i].y, 0);
	        			}
		        		mapCanvas.getAttackNum();
		        		mapCanvas.getAttackedNum();
		        		mapCanvas.checkWin();
		        		mapCanvas.cancelAttackTask();
		        	}
		        	++s;
		        	break;
		        case 8://Splash Screen
		        	switch(s){
		        	case 2:
		        		g.setColor(0x000000);
		        		g.fillRect(0,0,mapCanvas.getWidth(),mapCanvas.getHeight()/3);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.setColor(0x000000);
		        		g.fillRect(0,0,mapCanvas.getWidth(),mapCanvas.getHeight()/3*2);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 4:
		        		g.setColor(0x000000);
		        		g.fillRect(0,0,mapCanvas.getWidth(),mapCanvas.getHeight());
		        		mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.cancelSplashScreenTask();
		        		break;
		        	}
		        	++s;
		        	break;
		        case 9://girl in(0)
		        	switch(s){
		        	case 2:
		        		g.drawImage(mapCanvas.imgBegin, 0, 0, 0);
		        		g.drawImage(Image.createImage(mapCanvas.imgGirl,32,96,32,48,0), 0, 190, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.drawImage(mapCanvas.imgBegin, 0, 0, 0);
		        		g.drawImage(Image.createImage(mapCanvas.imgGirl,96,96,32,48,0), 25, 192, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.cancelPlotTask();
		        		mapCanvas.message(1);
		        	}
		        	++s;
		        	break;
		        case 10://girl out
		        	switch(s){
		        	case 2:
		        		g.drawImage(mapCanvas.imgBegin, 0, 0, 0);
		        		g.drawImage(Image.createImage(mapCanvas.imgGirl,96,48,32,48,0), 0, 190, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		g.drawImage(mapCanvas.imgBegin, 0, 0, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.message(3);
		        		mapCanvas.cancelPlotTask();
		        	}
		        	++s;
		        	break;
		        case 11://girl in(33)
		        	System.out.println("into choice");
		        	switch(s){
		        	case 2:
		        		mapCanvas.map.paint(g, 0, 0);
		        		g.drawImage(Image.createImage(mapCanvas.imgGirl,32,144,32,48,0), 108, 240, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	case 3:
		        		mapCanvas.map.paint(g, 0, 0);
		        		g.drawImage(Image.createImage(mapCanvas.imgGirl,96,144,32,48,0), 108, 208, 0);
		        		mapCanvas.flushGraphics();
		        		break;
		        	default:
		        		mapCanvas.message(10);
		        		mapCanvas.cancelPlotTask();
		        	}
		        	++s;
		        	break;
		        	
			}
		}
	}
}